{% extends "base.html" %}
{% block page %}
    <script language="JavaScript">
        function myrefresh()
        {
           window.location.reload();
        }
        setTimeout('myrefresh()',30000); //指定30秒刷新一次
    </script>
    <div class="div"><p>服务器资源预警</p></div>
    <div style="margin-top: 3%;width: 100%">
        <p style="color: red">
           {% if disk_data_time %}
               <strong>{{ disk_data_time }} 抓取数据</strong>
           {% endif %}
                {% if network_data_time %}
                <strong style="margin-left: 35%">{{ network_data_time }} 抓取数据</strong>
            {% endif %}
        </p>
        <div style="width: 46%;float:left;display: inline;border:1px solid #e5e5e5;margin-left: 3%" align="center">
                <p align="center"><strong>{{ MM }}磁盘可用容量</strong></p>
                <table class="datalist" border="1" align="center">
                    <tr>
                        {% set tables = ("服务器IP","磁盘路径","剩余容量") %}
                        {% for table in tables %}
                            <td style="overflow:hidden;text-align: center">{{ table }}</td>
                        {% endfor %}
                    </tr>
                    {% if disk_data %}
                        {% for val in disk_data %}
                            <tr class="altrow">
                                <td style="overflow:hidden;text-align: center">{{val}}</td>
                                {% for path in disk_data[val] %}
                                    <td style="overflow:hidden;text-align: center">{{path}}</td>
                                    <td style="overflow:hidden;text-align: center">{{disk_data[val][path]|int}}%</td>
                                {% endfor %}
                            </tr>
                        {% endfor %}
                    {% endif %}
                </table>
        </div>
        <div style="width: 46%;float:right;display: inline;border:1px solid #e5e5e5;margin-right: 3%" align="center">
                <p align="center"><strong>{{ MM }}网络连接数</strong></p>
                <table class="datalist" border="1" align="center">
                    <tr>
                        {% set tables = ("服务器IP","ESTABLISHED","TIME-WAIT") %}
                        {% for table in tables %}
                            <td style="overflow:hidden;text-align: center">{{ table }}</td>
                        {% endfor %}
                    </tr>
                    {% if network_data %}
                        {% for val in network_data %}
                            <tr class="altrow">
                                <td style="overflow:hidden;text-align: center">{{val}}</td>
                                {% for path in network_data[val] %}
                                    <td style="overflow:hidden;text-align: center">{{network_data[val][path]}}</td>
                                {% endfor %}
                            </tr>
                        {% endfor %}
                    {% endif %}
                </table>
        </div>
    </div>
{% endblock page %}